import Vue from 'vue'
// 引入 axios
import axios from 'axios'
import VueAxios from 'vue-axios'

// 引入顶部加载条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

// 数据请求接口
import './productListData'

// 挂载 axios
Vue.use(VueAxios, axios)
Vue.use(NProgress)

axios.interceptors.request.use(
  config => {
    NProgress.inc()
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

axios.interceptors.response.use(
  function (response) {
    NProgress.done()
    return response
  },
  function (error) {
    return Promise.reject(error)
  }
)
